package com.gmstu.springorm.common.utils;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * @author John.zhang
 * @version Id: Page, v 1.0 2020/9/1 15:54 ZhiYong Exp $
 */
public class Page<T> implements Serializable {

    private static final int DEFAULT_PAGE_SIZE = 20;

    private int pageSize = DEFAULT_PAGE_SIZE;

    private long start;

    private List<T> rows;

    private long totalSize;

    public Page() {
        this(0, 0, DEFAULT_PAGE_SIZE, new ArrayList<T>());
    }

    public Page(long start, long totalSize, int pageSize, List<T> rows) {
        this.start = start;
        this.totalSize = totalSize;
        this.pageSize = pageSize;
        this.rows = rows;
    }

    public long getTotalSize() {
        return totalSize;
    }

    public void setTotalSize(int totalSize) {
        this.totalSize = totalSize;
    }

    public List<T> getRows() {
        return rows;
    }
}
